/***********************************************************
* Purpose : insert Question
* Author : NuoiNV
* Date: 25/3/2012
* Description: insert Question
*/
IF exists (SELECT * FROM dbo.sysobjects WHERE NAME = 'sp_insertQuestion')
	DROP PROC sp_insertQuestion
GO
CREATE PROC sp_insertQuestion
	@Category_ID INT,
	@Content VARCHAR(max),
    @Status INTEGER,
	@RESULT	INT OUTPUT
AS
BEGIN
	DECLARE @Last_Update DATETIME
	SET @Last_Update = GETDATE()
	IF NOT EXISTS (SELECT * FROM Question  WHERE [Content] = @Content)
		Begin
			INSERT INTO Question VALUES (@Category_ID,@Content, @Status, @Last_Update)
			SET @RESULT = 1
		End
	Else
		Begin
			SET @RESULT = 0
		End
END

--SELECT * FROM Answer
